#!/usr/bin/env python

import wx
import app
import view
import resource

class About(wx.Dialog):
    '''About class
    
    @author Julot <andy.julot@gmail.com>
    @since Monday, January 30, 2012. 04:01 PM'''
    
    def __init__(self, parent):
        wx.Dialog.__init__(self, parent)
        
        meta = app.Meta()
        
        self.Title = 'About %s' % meta.name
        self.SetTransparent(240)
        
        spacer = resource.value.spacer
        
        bitmap = wx.StaticBitmap(self, size=(175, 230))
        bitmap.SetBitmap(resource.image.About.Bitmap)
        
        panel = wx.Panel(self)
        panel.SetBackgroundColour(wx.Colour(255, 255, 255))
        
        label = '%s - %s' % (meta.name, meta.description)
        title = wx.StaticText(panel, label=label)
        font = title.GetFont()
        font.SetWeight(wx.FONTWEIGHT_BOLD)
        title.SetFont(font)

        label = 'Version %s' % meta.long_version
        version = wx.StaticText(panel, label=label)

        label = 'Released at %s' % meta.release_date.strftime("%A, %B %d, %Y")
        release = wx.StaticText(panel, label=label)

        label = 'Created by %s <%s>' % (meta.author, meta.author_email)
        author = wx.StaticText(panel, label=label)

        label = 'Powered by wxPython && SQLite'
        poweredBy = wx.StaticText(panel, label=label)
        
        label = 'Melfina is taken from Seihou Bukyou Outlaw Star'
        about = wx.StaticText(panel, label=label)
        
        comment = wx.StaticText(panel, label=meta.comments)

        sizer4 = wx.BoxSizer(wx.VERTICAL)
        sizer4.AddSpacer(spacer)
        sizer4.Add(title)
        sizer4.Add(version)
        sizer4.Add(release)
        sizer4.AddSpacer(spacer)
        sizer4.Add(author)
        sizer4.Add(poweredBy)
        sizer4.AddSpacer(spacer * 2)
        sizer4.Add(about)
        sizer4.AddStretchSpacer(1)
        sizer4.Add(comment)
        sizer4.AddSpacer(spacer)
        
        sizer3 = wx.BoxSizer(wx.HORIZONTAL)
        sizer3.AddSpacer(spacer)
        sizer3.Add(sizer4, 1, flag=wx.GROW)
        sizer3.AddSpacer(spacer * 2)
        panel.SetSizerAndFit(sizer3)
        
        sizer2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer2.Add(bitmap, 0)
        sizer2.Add(panel, 1, flag=wx.GROW)
        
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(sizer2, 0)
        sizer.AddSpacer(spacer)
        button = self.CreateButtonSizer(wx.OK)
        sizer.Add(button, 0, wx.RIGHT | wx.ALIGN_RIGHT, spacer * 2)
        sizer.AddSpacer(spacer)
        
        self.SetSizerAndFit(sizer)
